summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCharles Lombardo <clombardo169@gmail.com>2023-08-31 01:05:33 +0200
committerCharles Lombardo <clombardo169@gmail.com>2023-08-31 01:05:33 +0200
commit50d4e0f4f77ea35dbdf1c07067e68fcd0ee2b326 (patch)
tree0c799a4836ed9923ccd98648e515b80ba0a1f7d4
parentandroid: Combine LongMessageDialogFragment with MessageDialogFragment (diff)
downloadyuzu-50d4e0f4f77ea35dbdf1c07067e68fcd0ee2b326.tar
yuzu-50d4e0f4f77ea35dbdf1c07067e68fcd0ee2b326.tar.gz
yuzu-50d4e0f4f77ea35dbdf1c07067e68fcd0ee2b326.tar.bz2
yuzu-50d4e0f4f77ea35dbdf1c07067e68fcd0ee2b326.tar.lz
yuzu-50d4e0f4f77ea35dbdf1c07067e68fcd0ee2b326.tar.xz
yuzu-50d4e0f4f77ea35dbdf1c07067e68fcd0ee2b326.tar.zst
yuzu-50d4e0f4f77ea35dbdf1c07067e68fcd0ee2b326.zip
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/IndeterminateProgressDialogFragment.kt2
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/main/MainActivity.kt163
2 files changed, 80 insertions, 85 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/IndeterminateProgressDialogFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/IndeterminateProgressDialogFragment.kt
index 739b26f99..181bd983a 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/IndeterminateProgressDialogFragment.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/IndeterminateProgressDialogFragment.kt
@@ -34,7 +34,7 @@ class IndeterminateProgressDialogFragment : DialogFragment() {
when (val result = taskViewModel.result.value) {
is String -> Toast.makeText(requireContext(), result, Toast.LENGTH_LONG).show()
is MessageDialogFragment -> result.show(
- parentFragmentManager,
+ requireActivity().supportFragmentManager,
MessageDialogFragment.TAG
)
}
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/main/MainActivity.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/main/MainActivity.kt
index 0721a5935..7d8e06ad8 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/main/MainActivity.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/main/MainActivity.kt
@@ -501,96 +501,91 @@ class MainActivity : AppCompatActivity(), ThemeProvider {
var errorBaseGame = 0
var errorExtension = 0
var errorOther = 0
- var errorTotal = 0
- lifecycleScope.launch {
- documents.forEach {
- when (NativeLibrary.installFileToNand(it.toString())) {
- NativeLibrary.InstallFileToNandResult.Success -> {
- installSuccess += 1
- }
-
- NativeLibrary.InstallFileToNandResult.SuccessFileOverwritten -> {
- installOverwrite += 1
- }
-
- NativeLibrary.InstallFileToNandResult.ErrorBaseGame -> {
- errorBaseGame += 1
- }
-
- NativeLibrary.InstallFileToNandResult.ErrorFilenameExtension -> {
- errorExtension += 1
- }
-
- else -> {
- errorOther += 1
- }
+ documents.forEach {
+ when (NativeLibrary.installFileToNand(it.toString())) {
+ NativeLibrary.InstallFileToNandResult.Success -> {
+ installSuccess += 1
}
- }
- withContext(Dispatchers.Main) {
- val separator = System.getProperty("line.separator") ?: "\n"
- val installResult = StringBuilder()
- if (installSuccess > 0) {
- installResult.append(
- getString(
- R.string.install_game_content_success_install,
- installSuccess
- )
- )
- installResult.append(separator)
+
+ NativeLibrary.InstallFileToNandResult.SuccessFileOverwritten -> {
+ installOverwrite += 1
}
- if (installOverwrite > 0) {
- installResult.append(
- getString(
- R.string.install_game_content_success_overwrite,
- installOverwrite
- )
- )
- installResult.append(separator)
+
+ NativeLibrary.InstallFileToNandResult.ErrorBaseGame -> {
+ errorBaseGame += 1
}
- errorTotal = errorBaseGame + errorExtension + errorOther
- if (errorTotal > 0) {
- installResult.append(separator)
- installResult.append(
- getString(
- R.string.install_game_content_failed_count,
- errorTotal
- )
- )
- installResult.append(separator)
- if (errorBaseGame > 0) {
- installResult.append(separator)
- installResult.append(
- getString(R.string.install_game_content_failure_base)
- )
- installResult.append(separator)
- }
- if (errorExtension > 0) {
- installResult.append(separator)
- installResult.append(
- getString(R.string.install_game_content_failure_file_extension)
- )
- installResult.append(separator)
- }
- if (errorOther > 0) {
- installResult.append(
- getString(R.string.install_game_content_failure_description)
- )
- installResult.append(separator)
- }
- MessageDialogFragment.newInstance(
- titleId = R.string.install_game_content_failure,
- descriptionString = installResult.toString().trim(),
- helpLinkId = R.string.install_game_content_help_link
- ).show(supportFragmentManager, MessageDialogFragment.TAG)
- } else {
- MessageDialogFragment.newInstance(
- titleId = R.string.install_game_content_success,
- descriptionString = installResult.toString().trim()
- ).show(supportFragmentManager, MessageDialogFragment.TAG)
+
+ NativeLibrary.InstallFileToNandResult.ErrorFilenameExtension -> {
+ errorExtension += 1
+ }
+
+ else -> {
+ errorOther += 1
}
}
}
- return@newInstance installSuccess + installOverwrite + errorTotal
+
+ val separator = System.getProperty("line.separator") ?: "\n"
+ val installResult = StringBuilder()
+ if (installSuccess > 0) {
+ installResult.append(
+ getString(
+ R.string.install_game_content_success_install,
+ installSuccess
+ )
+ )
+ installResult.append(separator)
+ }
+ if (installOverwrite > 0) {
+ installResult.append(
+ getString(
+ R.string.install_game_content_success_overwrite,
+ installOverwrite
+ )
+ )
+ installResult.append(separator)
+ }
+ val errorTotal: Int = errorBaseGame + errorExtension + errorOther
+ if (errorTotal > 0) {
+ installResult.append(separator)
+ installResult.append(
+ getString(
+ R.string.install_game_content_failed_count,
+ errorTotal
+ )
+ )
+ installResult.append(separator)
+ if (errorBaseGame > 0) {
+ installResult.append(separator)
+ installResult.append(
+ getString(R.string.install_game_content_failure_base)
+ )
+ installResult.append(separator)
+ }
+ if (errorExtension > 0) {
+ installResult.append(separator)
+ installResult.append(
+ getString(R.string.install_game_content_failure_file_extension)
+ )
+ installResult.append(separator)
+ }
+ if (errorOther > 0) {
+ installResult.append(
+ getString(R.string.install_game_content_failure_description)
+ )
+ installResult.append(separator)
+ }
+ return@newInstance MessageDialogFragment.newInstance(
+ titleId = R.string.install_game_content_failure,
+ descriptionString = installResult.toString().trim(),
+ helpLinkId = R.string.install_game_content_help_link
+ )
+ } else {
+ return@newInstance MessageDialogFragment.newInstance(
+ titleId = R.string.install_game_content_success,
+ descriptionString = installResult.toString().trim()
+ )
+ }
}.show(supportFragmentManager, IndeterminateProgressDialogFragment.TAG)
}
}